A router must store the changes in router configuration that it receives every now and then as new connections are set up and old ones become obsolete. Configuration data is essential for the correct operation of the router, and it must be stored in a form from which it can be later retrieved even if an unexpected error has occurred and caused data in the volatile run-time memory to become corrupt or vanish. A file that contains accumulated data about changes in router configuration is frequently referred to as a delta log.
Some prior art routers utilize flash memory as a non-volatile storage, into which the delta log is stored in compressed form. The storing algorithm for storing the delta log must take into account that data is accumulated continuously, and a failure may occur at any moment, so data should not be allowed to accumulate in volatile memory only for a long time before a next copy to non-volatile flash memory is made. On the other hand the known structure and operation of flash memory is ill suited for continuous bit-by-bit storing, and favours handling the flash memory in larger units called records.
FIG. 1 illustrates a known way of utilizing flash memory for storing a delta log according to prior art. Two separate sections of flash memory have been allocated, referred here to as the flash buffer 101 and the flash file 102. Configuration data is first stored in the flash buffer 101 and only transferred to the flash file 102 after a large enough chunk of data has accumulated to essentially fill the flash buffer 101.
At step 111 both sections of flash memory are empty. A write pointer, illustrated schematically as a small arrow, shows the location in each section of flash memory where the next write operation will begin. At step 112 a piece of configuration data 103 is written into the flash buffer, causing the write pointer to move to the next free space in the buffer. The old location of the write pointer is shown with an arrow in brackets. Nothing happens in the flash file yet. A similar incident occurs at step 113, where a next piece of configuration data 104 is written into the flash buffer. Only at step 114, when the flash buffer becomes full, something is written to the flash file also: the accumulated contents of the flash buffer are compressed using some suitable data compression algorithm, and the compression result 105 is written to the flash file. The write pointer in the flash file advances to point at the next free location. At step 115 the flash buffer is cleared, and a new round of accumulating configuration data into the flash buffer begins. Next time when compression occurs, the new compression result will follow the previous one in the flash file.
The drawback of the arrangement of FIG. 1 is the relatively large requirement of flash memory space.